﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using SqlCon;

using System.Collections;
namespace yfxt
{
    public partial class cx_ypxxcx_xg : Form
    {
        public cx_ypxxcx_xg()
        {
            InitializeComponent();
        }

        
        SqlConnection conn = new SqlConnection(SqlHelper.ConnectionStringLocalTransaction);

       

     

        private void button1_Click(object sender, EventArgs e)
        {
        }

        private void cx_ypxxcx_xg_Load(object sender, EventArgs e)
        {

            //ypcx = (cx_ypxxcx)this.Owner;


            string s = " select ypmc,ypgg,ypdw,(case zblb when '1' then '西药'when '2' then '中成药'when '3' then '中草药' end) as zblb," +
                      " sxmc,ypjl,jldw,(case ypdc when '0' then '国产' when '1' then '外资' end) as ypdc,ypxq,yk_typk.pydm as pydm,ypxh," +
                      "(case zblb when '1' then '西药'when '2' then '中成药'when '3' then '中草药' end) as zblb,ypdm,zjpb,jzyy,pspb,zssf," +
                      " zxdw,zxbz,yfgg,bfgg,yfdw,bfdw,yfbz,bfbz,yfzf,ykzf,bfzf," +
                      " gcsl,dcsl,yfgc,bfgc,yfdc,bfdc,ydysy,bxlc," +
                      " fsmc,gyff,tsyp,ylxz " +
                      " from yk_typk,zy_fyfs,yk_ypsx " +
                      " where yk_typk.ypsx=yk_ypsx.ypsx and yk_typk.fyfs=zy_fyfs.fyfs " +
                      " and yk_typk.ypxh='" +SqlHelper.s.ToString() + " ' ";

            if (conn.State != ConnectionState.Open) { conn.Open(); }
            using (SqlCommand cmd = new SqlCommand(s, conn))
            {
                SqlDataReader dr = cmd.ExecuteReader();

                while (dr.Read())
                {
                    textBox1.Text = dr["ypmc"].ToString();
                    textBox2.Text = dr["ypgg"].ToString();
                    textBox3.Text = dr["ypdw"].ToString();
                    textBox4.Text = dr["zblb"].ToString();
                    textBox5.Text = dr["sxmc"].ToString();
                    textBox6.Text = dr["ypjl"].ToString();
                    textBox29.Text = dr["jldw"].ToString();
                    textBox7.Text = dr["ypdc"].ToString();
                    textBox8.Text = dr["ypxq"].ToString();
                    textBox9.Text = dr["pydm"].ToString();
                    textBox10.Text = dr["ypxh"].ToString();

                    textBox30.Text = dr["ypdm"].ToString();
                    textBox31.Text = dr["zblb"].ToString();


                    textBox11.Text = dr["zxdw"].ToString();
                    textBox12.Text = dr["yfgg"].ToString();
                    textBox13.Text = dr["yfdw"].ToString();
                    textBox14.Text = dr["yfbz"].ToString();
                    textBox15.Text = dr["zxbz"].ToString();
                    textBox16.Text = dr["bfgg"].ToString();
                    textBox17.Text = dr["bfdw"].ToString();
                    textBox18.Text = dr["bfbz"].ToString();

                    textBox19.Text = dr["gcsl"].ToString();
                    textBox20.Text = dr["yfgc"].ToString();
                    textBox21.Text = dr["bfgc"].ToString();
                    textBox22.Text = dr["dcsl"].ToString();
                    textBox23.Text = dr["yfdc"].ToString();
                    textBox24.Text = dr["bfdc"].ToString();


                    textBox25.Text = dr["fsmc"].ToString();
                    textBox26.Text = dr["gyff"].ToString();
                    textBox27.Text = dr["tsyp"].ToString();
                    textBox28.Text = dr["ylxz"].ToString();




                    if (dr["zjpb"].ToString().Equals("1"))
                    {
                        checkBox1.Checked = true;
                    }
                    else
                    {
                        checkBox1.Checked = false;
                    }

                    if (dr["jzyy"].ToString().Equals("1"))
                    {
                        checkBox2.Checked = true;
                    }
                    else
                    {
                        checkBox2.Checked = false;
                    }

                    if (dr["pspb"].ToString().Equals("1"))
                    {
                        checkBox3.Checked = true;
                    }
                    else
                    {
                        checkBox3.Checked = false;
                    }

                    if (dr["zssf"].ToString().Equals("0"))
                    {
                        checkBox4.Checked = true;
                    }
                    else
                    {
                        checkBox4.Checked = false;
                    }

                    if (dr["yfzf"].ToString().Equals("1"))
                    {
                        checkBox5.Checked = true;
                    }
                    else
                    {
                        checkBox5.Checked = false;
                    }

                    if (dr["ykzf"].ToString().Equals("0"))
                    {
                        checkBox6.Checked = true;
                    }
                    else
                    {
                        checkBox6.Checked = false;
                    }

                    if (dr["bfzf"].ToString().Equals("1"))
                    {
                        checkBox7.Checked = true;
                    }
                    else
                    {
                        checkBox7.Checked = false;
                    }


                    if (dr["ydysy"].ToString().Equals("1"))
                    {
                        checkBox8.Checked = true;
                    }
                    else
                    {
                        checkBox8.Checked = false;
                    }

                    if (dr["bxlc"].ToString().Equals("0"))
                    {
                        checkBox9.Checked = true;
                    }
                    else
                    {
                        checkBox9.Checked = false;
                    }


                }
            }



        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
